<html>
<head><meta charset="utf-8"><title>Casting between `&amp;!Sized` · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Casting.20between.20.60.26!Sized.60.html">Casting between `&amp;!Sized`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215370549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Casting%20between%20%60%26%21Sized%60/near/215370549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Casting.20between.20.60.26!Sized.60.html#215370549">(Nov 02 2020 at 19:59)</a>:</h4>
<p>One thing I did like about having a stability mechanism in safe-transmute was that it could allow things like casting <code>&amp;[T]</code> to <code>&amp;SliceWrapper&lt;T&gt;</code> without needing that to be exposed to consumers.</p>
<p>Any thoughts on what a feature for that would look like without it using safe-transmute?  I guess it would need to be some sort of cast, since it can't be a library thing?  (Well, <code>unsafe</code> can do it of course, but I'd really like a safe way.)</p>



<a name="215385342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Casting%20between%20%60%26%21Sized%60/near/215385342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Casting.20between.20.60.26!Sized.60.html#215385342">(Nov 02 2020 at 22:01)</a>:</h4>
<p>Yeah, that was a really nice feature. I mean, maybe we should look into scoped impls.</p>



<a name="215385350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Casting%20between%20%60%26%21Sized%60/near/215385350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Casting.20between.20.60.26!Sized.60.html#215385350">(Nov 02 2020 at 22:01)</a>:</h4>
<p>not impossible to imagine.</p>



<a name="215386059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Casting%20between%20%60%26%21Sized%60/near/215386059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Casting.20between.20.60.26!Sized.60.html#215386059">(Nov 02 2020 at 22:08)</a>:</h4>
<p>Doing it at the module level seems like it'd be super-hard, but also doesn't seem strictly necessary.  Like if it only worked with <code>crate impl Foo for Bar</code> I think I'd be ok with that.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>